using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FiltronASP.Modules.Abstracts;
using FiltronASP.Models.DAO.Interfaces;
using System.Web.UI.WebControls;
using FiltronASP.Models;
using FiltronASP.Models.DAO.Filtron;
using FiltronASP.Models.DAO.Interfaces.Filtron;
using FiltronASP.Helpers.Translations;

namespace FiltronASP.Modules
{
    public class sizesCarsSearchModule : AbstractModule
    {

        /// <summary>
        /// Klasa odpowiedzialna za generowanie contentu przez modul.
        /// </summary>
        /// <param name="page">biezaca strona</param>
        /// <returns>content</returns>
        public override string GenerateContent(FiltronASP.Models.Page page)
        {
            return this.generateBottomMenu() + this.generateInnerContent();
        }

        private string generateBottomMenu() 
        {
            string htmlToReturn = "";
            htmlToReturn += "<div id=\"bottomMenu\">";
            htmlToReturn += "   <ul class=\"selectMarketMenu\">";
            htmlToReturn += "       <li class=\"EU active\"><a href=\"passenger,94.html\"><span>EU</span><img src=\"../../../Content/images/app_flagEU.png\" alt=\"EU\" /></a></li>";
            htmlToReturn += "       <li class=\"US\"><a href=\"passenger,83.html\"><span>US</span><img src=\"../../../Content/images/app_flagUS.png\" alt=\"US\" /></a></li>";
            htmlToReturn += "   </ul>";
            htmlToReturn += "   <ul class=\"selectCarTypeMenu\">";

            htmlToReturn += "<li class=\"\"><a href=\"passenger-car,94.html\"><span>Auta osobowe</span></a></li>";
            htmlToReturn += "<li class=\"\"><a href=\"trucks-and-bus,95.html\"><span>Ciężarowe i autobusy</span></a></li>";
            htmlToReturn += "<li class=\"\"><a href=\"heavy-duty,103.html\"><span>Pojazdy ciężkie i maszyny</span></a></li>";
            htmlToReturn += "<li class=\"\"><a href=\"machines-and-others,99.html\"><span>Pozostałe pojazdy i maszyny</span></a></li>";
            htmlToReturn += "<li class=\"\"><a href=\"motorcycles,105.html\"><span>Motocykle</span></a></li>";
            htmlToReturn += "<li class=\"\"><a href=\"quad,106.html\"><span>Quady</span></a></li>";
            //htmlToReturn += "<li class=\"\"><a href=\"applications,109.html\"><span>Zastosowania</span></a></li>";
            htmlToReturn += "<li class=\"\"><a href=\"cross-list,104.html\"><span>Zamienniki</span></a></li>";
            htmlToReturn += "<li class=\"active\"><a href=\"lpg,108.html\"><span>LPG</span></a></li>";

            htmlToReturn += "   </ul>"; //</selectCarTypeMenu>
            htmlToReturn += "<div id=\"selectMarketMenuUnder\">Select<br />Market</div>";
            htmlToReturn += "<div id=\"selectCarTypeMenuUnder\">";
            htmlToReturn += "</div>"; //</selectCarTypeMenuUnder>
            htmlToReturn += "</div>"; //</bottomMenu>            
            return htmlToReturn;
        }

        private string generateInnerContent() {
            string htmlToReturn = "";
            htmlToReturn += " <div id=\"contentHolderInner\">";            
            htmlToReturn += this.generateEnginePart();
            return htmlToReturn;
        }

        private string generateEnginePart() {
            string htmlToReturn = "";
            htmlToReturn += "<div id=\"searchLeftSide\" style=\"display: block !important;\">";

            htmlToReturn += "<h3>Select LPG</h3>";
            htmlToReturn += "<table id=\"specialFilterTable\">";
            htmlToReturn += "<thead><tr><td class=\"engine\">Filtron</td><td class=\"gs\">Gas</td></tr></thead>";
            htmlToReturn += "<tbody>";
            
            IFiltronSpecialFiltersDAO FiltronSpecialFiltersDAO = new FiltronSpecialFiltersDAO();
            IQueryable<filtron_special_filter> specialCollection = FiltronSpecialFiltersDAO.FindAll();
            foreach (filtron_special_filter special in specialCollection)
            {
                IFiltronFilterDAO filtronFilterDAO = new FiltronFilterDAO();
                FiltronFilter filterSingle = filtronFilterDAO.FindByPK(special.filter_id);

                htmlToReturn += "<tr id=\"specialSelect-"+special.filter_id+"\" onclick=\"specialTrActive(this, "+special.filter_id+")\" class=\"\">";
                htmlToReturn += "<td>" + filterSingle.filter_number + "</td>";
                htmlToReturn += "<td>" + special.special_filter_installation + "</td>";
                htmlToReturn += "</tr>";
            }
            
            htmlToReturn += "</tbody>";
            htmlToReturn += "</table>";

            

            htmlToReturn += "</div>";
            htmlToReturn += "<div id=\"searchRightSide\">";
            htmlToReturn += "   <div class=\"searchRightSideTop\"></div>";
            htmlToReturn += "   <div id=\"searchRightSideBottom\"></div>";
            htmlToReturn += "</div>";
            return htmlToReturn;
        }
    }
}
